#pragma once
#include"RBTree.h"
namespace myspace
{
	template<class K>
	class set
	{
	public:
		struct SetKeyOfT
		{
			const K& operator()(const K& k)
			{
				return k;
			}
		};
		typedef typename RBTreee<K, K, SetKeyOfT>::iterator iterator;
		iterator begin()
		{
			return _t.begin();
		}
		iterator end()
		{
			return _t.end();
		}
		bool Insert(const K& k)
		{
			return _t.Insert(k);
		}
		void Inorder()
		{
			_t.Inorder();
		}
	private:
		RBTreee<K,K,SetKeyOfT> _t;
	};
	void TestMySet1()
	{
		cout << "TestSet1" << endl;
		myspace::set<int> s;
		s.Insert(3);
		s.Insert(1);
		s.Insert(2);
		s.Insert(5);
		s.Insert(4);
		s.Insert(6);
		s.Inorder();
		set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
		//set<int>::iterator it2 = s.begin();
		//++it2; ++it2;
		//++it2;
		//while (it2 != s.begin())
		//{
		//	cout << *it << " ";
		//	--it2;
		//}
		//cout << endl;
		cout << "TestSet1" << endl;
	}


}